﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>图片资料管理系统 V1.0</title>
        <link href="/Public/css/public.css" rel="stylesheet">
        <link href="/Public/css/ljPublic.css" rel="stylesheet">
</head>
<body>
    <form id="form1" runat="server">
        <div class="wrap">
            <div class="container">    
            <div id="login" style="margin-top:10%; background-color:#fff; padding:20px;-webkit-border-radius:10px;border-radius:10px;">         
                <div style=" text-align:center; font-size:26px; font-weight:bold; line-height:50px; margin-bottom:15px; color:#0C4A35;">
                    <asp:Literal ID="Literal1" runat="server"></asp:Literal><br />图片资料管理系统</div>
                <ul>
             
                    <li class="inpLi" style=" background-color:#f5f5f5;"><b style=" border-right:1px solid #CCC;background-color:#e9e9e9;">用户名：</b>
                    <input type="text" name="username" value="" class="inpLogin" style=" background-color:#f8f8f8" id="phonenumber" /></li>
                    <li class="inpLi" style=" background-color:#f5f5f5;"><b style=" border-right:1px solid #CCC;background-color:#e9e9e9;" />密&nbsp&nbsp码：</b>
                    <input type="password" name="password" class="inpLogin" style=" background-color:#f8f8f8;" id="password">
                    </li>
                    <li>
                        <input class="btn" type="button" id="sub_bt"  back_url="/Login.ashx"  value="登 录">
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <span class="error"></span>
                    </li>
                </ul>
            </div> 
            <%=Footer %>
            </div>
        </div>
        <script src="Public/Home/js/jquery1.7.2.js"></script>
        <script>
            $('#sub_bt').click(function () { req_ajax() });
            $('#password').keydown(function (e) { if (e.keyCode == 13) req_ajax() });
            function req_ajax() {
                var name = $('#phonenumber').val();
                var pword = $('#password').val();
                var posturl = $('#sub_bt').attr('back_url');                
                $.ajax({
                    url: posturl,
                    type: 'POST',
                    dataType: 'JSON',
                    data: { username: name, password: pword },
                    success: function (msg) {
                        if (msg.code != 200) {
                            alert(msg.msg)
                        } else {
                            window.location.href = msg.forward;
                        }
                    }, error: function (msg) { alert('登录失败，请检查网络后重试！'+msg.code); }
                });
            }
        </script>
    </form>
</body>
</html>
